<?php
        $page = $_GET['page'];
        $start = ($page - 1) * 4;

       // 连接数据库
       include './conn.php';
       $sql = "SELECT img_url FROM t_articles  ORDER BY id DESC LIMIT $start, 10";
       $count_sql = "SELECT count(id) as total FROM t_articles";
     
        $total = $mysqli->query($count_sql);
        $total = Mysqli_fetch_assoc($total)['total'];
      $result = $mysqli->query($sql);
      
      // 处理result
      if(mysqli_num_rows($result)){
        while($row = Mysqli_fetch_assoc($result)){
          $articles[] = $row; // 将$row添加到$articles中
        }}
      else{
        $articles = array();
      }
    
      $array = array('code' => 200, 'msg' => '请求成功', 'result' => $articles, 'total'=>$total);

      echo(json_encode($array));